home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / c / cxref-1.001 / cxref-1~ / cxref / README < prev    next >
Encoding:
Text File  |  1996-02-13  |  11.3 KB  |  244 lines

  1.              C Cross Referencing & Documenting tool. Version 1.0
  2.              ===================================================
  3.  
  4. A program that can automatically generate documentation and cross references
  5. for a C program.
  6.  
  7. The input is any C program with appropriate comments and the output is LaTeX
  8. or HTML files.
  9.  
  10. --------------------------------------------------------------------------------
  11. ------------------------------- Program Options --------------------------------
  12. --------------------------------------------------------------------------------
  13.  
  14. The name of the program is cxref.
  15.  
  16. Usage: cxref filename [ ... filename]
  17.              [-Idirname]
  18.              [-Ddefine] [-Udefine]
  19.              [-CPP cpp_program]
  20.              [-Odirname]
  21.              [-Nbasename]
  22.              [-all-comments]
  23.              [-xref[-all][-file][-func][-var][-type]]
  24.              [-warn[-all][-comment][-xref]]
  25.              [-index[-all][-file][-func][-var][-type]]
  26.              [-raw]
  27.              [-latex|-latex2e]
  28.              [-html]
  29.  
  30. filename        The name of the file to document, any number of files may be
  31.                 documented at a time.
  32.  
  33. -Idirname       GCC option to specify the path for include files.
  34. -Ddefine        GCC option to define a pre-processor symbol.
  35. -Udefine        GCC option to undefine a pre-processor symbol.
  36. -CPP program    The name of the program to use instead of the compile time
  37.                 default. The program must be able to perform all of the actions
  38.                 that `gcc -E -C -dD' does to work. If the program takes
  39.                 arguments then the whole thing needs to be in quotes so that it
  40.                 is interpreted as a single argument to cxref.
  41.  
  42. -Odirname       The name of a directory to use for the output latex files and
  43.                 the location of the cross reference files that are created.
  44.  
  45. -Nbasename      The name to use for the first part of the output and cross
  46.                 reference files instead of cxref, the file extensions remain
  47.                 the same.
  48.  
  49. -all-comments   In case you are lazy and think that the existing comments might
  50.                 work, (see below for description of special comments).
  51.                 [Danger! This option can produce weird results.]
  52.  
  53. -xref           Produce cross referencing information (see below).
  54.                 -all    All cross references.
  55.                 -file   Cross references for files.
  56.                 -func   Cross references for functions.
  57.                 -var    Cross references for variables.
  58.                 -type   Cross references for types.
  59.  
  60. -warn           Produce warnings, the options must be concatenated together:
  61.                 -all       All warnings.
  62.                 -comment   Warn of missing comments.
  63.                 -xref      Warn of missing cross references.
  64.  
  65. -index          Produce a cross reference index, the options must be
  66.                 concatenated together:
  67.                 -all    All indexes.
  68.                 -file   Index of files.
  69.                 -func   Index of functions.
  70.                 -var    Index of variables.
  71.                 -type   Index of types.
  72.  
  73. -raw            Produce a raw form of output, not really of much use except
  74.                 with -warn.
  75.  
  76. -latex          Produce a LaTeX file to document each of the source files and
  77.                 also an extra file that includes each of these files.
  78. -latex2e        Produce the LaTeX file for use with the LaTeX2e version.
  79.  
  80. -html           Produce an HTML file to document each of the source files and
  81.                 a main file to reference each of these files.
  82.  
  83. --------------------------------------------------------------------------------
  84. ------------------------ Program Documentation Comments ------------------------
  85. --------------------------------------------------------------------------------
  86.  
  87. The documentation for the program is produced from comments in the code that
  88. are appropriatly formatted. The cross referencing comes from the code itself
  89. and requires no extra work.
  90.  
  91. The special comments are `/**** ****/' (for a file) and `/*++++ ++++*/' (for a
  92. data object) any number of `*' or `+' can be used inside of the standard `/*'
  93. and `*/' comment delimiters in the comments, they are ignored.
  94.  
  95. In any situation where a comment follows a `,', `;' or `)' separated only by
  96. spaces and tabs, the comment is pushed to before the punctuation to apply to
  97. object there.
  98.  
  99. The program is implemented using a full ANSI C grammar parser with some GCC
  100. extensions, this means that the style of the code is unimportant, only the
  101. content and comments.
  102.  
  103. --------------------------------------------------------------------------------
  104. ------------------------- Automated Comment Insertion --------------------------
  105. --------------------------------------------------------------------------------
  106.  
  107. To simplify the insertion of comments that will be parsed by cxref, the file
  108. cxref.el provides a number of Emacs lisp functions. To use them add the line
  109. `(load "cxref")' to your `.emacs' file or type `M-x load-file cxref.el' from
  110. within Emacs.
  111.  
  112. The functions and key bindings are:
  113.  
  114. Control-C Control-F - Adds file comments, a /** **/ header at the top of the
  115.                       file and if it is a .h file then it also adds a #ifndef,
  116.                       #define at the beginning and #endif at the end to stop
  117.                       multiple inclusions.
  118.  
  119. Control-C f         - Adds comments to a function, the cursor must be on the
  120.                       line containing the start of the function definition when
  121.                       this function is called. The /*+ ... +*/ comment that is
  122.                       added is of the header type (see the examples) not inline.
  123.  
  124. Control-C v         - Adds a leading comment to the variable or other definition
  125.                       on the current line.
  126.  
  127. Control-C e         - Adds a trailing comment at the end of the line.
  128.  
  129. Control-C i         - Adds an inline comment that is ignored by cxref.
  130.  
  131. --------------------------------------------------------------------------------
  132. -------------------------------- C Preprocessor --------------------------------
  133. --------------------------------------------------------------------------------
  134.  
  135. To improve the output that is available a modified version of the GNU CPP V2.6.3
  136. is supplied (named cxref-cpp).
  137.  
  138. Some comment styles are only available if cxref-cpp is used, see the `Example
  139. Special Comments' section of this README.
  140.  
  141. The #include filenames are also full pathnames if cxref-cpp is not used.
  142.  
  143. To enable this option, the Makefile for cxref must be modified when cxref is
  144. compiled, the variable CPP_TO_USE must be set to point at the place where the
  145. C preprocessor is to be installed. If CPP_TO_USE is defined to an empty value
  146. then `gcc -E -C -dD' is used as the C preprocessor and the extra features are
  147. not available.
  148. To see which option is enabled, run cxref with no arguments, this prints the
  149. name of the preprocessor that is used, if the command is `cxref-cpp' then the
  150. option is enabled.
  151.  
  152. --------------------------------------------------------------------------------
  153. --------------------------- Example Special Comments ---------------------------
  154. --------------------------------------------------------------------------------
  155.  
  156. See the `README.c' file, to see that the comments are indeed seen in the code,
  157. run `cxref README.c -raw', the comments are indicated in chevrons `<<< >>>'.
  158.  
  159. The comments only available with the cxref-cpp pre-processor are indicated.
  160.  
  161. --------------------------------------------------------------------------------
  162. ------------------------------ Cross Referencing -------------------------------
  163. --------------------------------------------------------------------------------
  164.  
  165. The cross referencing is performed for the following items
  166.  
  167. Files           - The files that the current file is included in
  168.                   (even when included via other files).
  169.  
  170. #includes       - Files included in the current file.
  171.                 - Files included by these files etc.
  172.  
  173. Variables       - The location of the definition of external variables.
  174.                 - The files that have visibility of global variables.
  175.                 - The files / functions that use the variable.
  176.  
  177. Functions       - The file that the function is prototyped in.
  178.                 - The functions that the function calls.
  179.                 - The functions that call the function.
  180.                 - The files and functions that reference the function.
  181.                 - The variables that are used in the function.
  182.  
  183. Each of these items is cross referenced in the output.
  184.  
  185. The cross referencing uses files `cxref.variable', `cxref.function',
  186. `cxref.include' and `cxref.typedef' in the output directory.
  187. These are a complete list of the function and variable usage in the program and
  188. could be used to generate a function call hierarchy or variable usage diagram
  189. for example.
  190. Two cxref passes of each file is needed, the first to build up the cross
  191. referencing files and the second to use them.
  192.  
  193. (The file names are different if the `-N' option is used.)
  194.  
  195. --------------------------------------------------------------------------------
  196. --------------------------------- LaTeX Output ---------------------------------
  197. --------------------------------------------------------------------------------
  198.  
  199. The default LaTeX output is a file for each of the source files with one extra
  200. file `cxref.tex' that includes each of the other files. This is to allow a
  201. makefile to only update the changed files (although the references may require
  202. all of the files to be checked again). When the cxref.tex file has been written
  203. it can be modified by the user, any new files that are added are added at the
  204. end before the table of contents, the rest of the file being unchanged.
  205.  
  206. The index is written to a file called `cxref.apdx.tex' and cxref.tex is updated
  207. to refer to it.
  208.  
  209. Also written out are two LaTeX style files `page.sty' and `fonts.sty', these use
  210. a smaller margin and smaller font to allow more to appear on a page.
  211.  
  212. (The file names `cxref.tex' and `cxref.apdx.tex' are different if the `-N'
  213. option is used.)
  214.  
  215. --------------------------------------------------------------------------------
  216. --------------------------------- HTML Output ----------------------------------
  217. --------------------------------------------------------------------------------
  218.  
  219. The default HTML output is a file for each of the source files with one extra
  220. file `cxref.html' that includes each of the other files. This is to allow a
  221. makefile to only update the changed files (although the references may require
  222. all of the files to be checked again). When the cxref.html file has been written
  223. it can be modified by the user, any new files that are added are added at the
  224. end before the table of contents, the rest of the file being unchanged.
  225.  
  226. The index is written to a file called `cxref.apdx.html' and cxref.html is
  227. updated to refer to it.
  228.  
  229. (The file names `cxref.html' and `cxref.apdx.html' are different if the `-N'
  230. option is used.)
  231.  
  232. --------------------------------------------------------------------------------
  233. ----------------------------- AUTHOR and Copyright -----------------------------
  234. --------------------------------------------------------------------------------
  235.  
  236. The cxref program was written by Andrew M. Bishop in 1995,96.
  237.  
  238. The cxref program is copyright Andrew M. Bishop 1995,96.
  239.  
  240. email: amb@gedanken.demon.co.uk [Please put cxref in the subject line]
  241.  
  242. The cxref program can be freely distributed according to the terms of the GNU
  243. General Public License (see the file `COPYING').
  244.